<?php
namespace app\api\controller;

use app\common\model\ViewBlockContent;
use think\Controller;
use app\common\model\ViewBlock as ViewBlockModel;

class ViewBlock extends Controller
{
    public function modifyBlock()
    {
    	$vb=new ViewBlockModel();
    	$input=input();
    	if($input['id']){
    		$result=$vb->editVB($input);
	    }else{
    		$result=$vb->addVB($input);
	    }
	    if($result){
    		$this->success("操作成功");
	    }else{
	    	$this->error("操作失败");
	    }
    }
	
	public function modifyContent()
	{
		$vb=new ViewBlockContent();
		$input=input();
		if($input['id']){
			$result=$vb->editVBC($input);
		}else{
			$result=$vb->addVBC($input);
		}
		if($result){
			$this->success("操作成功");
		}else{
			$this->error("操作失败");
		}
	}
	
	public function delContent(){
		$vb=new ViewBlockContent();
		$result=$vb->deleteVBC(['id'=>input('id')]);
		if($result){
			$this->success("操作成功");
		}else{
			$this->error("操作失败");
		}
	}
}
